<template>
  <div class="register-container">
    <div @click="login">登录</div>
  </div>
</template>
<script>
export default {
  name: 'Login',
  data() {
    return {
      radio: 0,
      loginData: {
        email: 'admin',
        password: '123456'
      }
    }
  },

  methods: {
    // 登录: 先检查数据, 然后执行登录操作
    async login() {
      await this.$store.dispatch('user/login', {
        username: this.loginData.email,
        password: this.loginData.password
      })
      this.$router.push({ name: '/home',
        query: {
          vconsole: true
        }})
    }
  }
}
</script>

<style scoped lang="scss">
.register-container {
  width: 100%;
  height: 100%;
  background-size: cover;
  .register-card {
    width: 500px;
    background: #fff;
    border-radius: 5px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}
</style>
